package com.woniuxy01;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

class Aaa{
    public void test01() throws Exception{}
}
class Bbb extends Aaa{
    public void test01() throws RuntimeException{}
}

public class Test02 {

    public static void main(String[] args) {
        try {
            Date date = stringToDate04("xxx");
            System.out.println(date);
        } catch (Exception e) {
            //吞掉了异常:处理了，程序员不知道哪个地方出问题了
//            System.out.println(e.getMessage());
            e.printStackTrace();
//            throw new RuntimeException(e);
//            System.out.println("处理异常");
        }
        System.out.println("程序结束");
    }

    public static Date stringToDate04(String str) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date date = sdf.parse(str);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
